import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

/**
 * 页面组件
 */
import { LoginComponent } from './page/login/login.component';
import { MainComponent } from './page/main/main.component';
import { SiteSummaryComponent } from './page/main/site-summary/site-summary.component';
import { PageNotFoundComponent } from './page/main/page-not-found/page-not-found.component';
import { SiteListComponent } from './page/main/site-list/site-list.component';
import { StartStopComponent } from './page/main/start-stop/start-stop.component';
import { SiteConfigComponent } from './page/main/site-config/site-config.component';



const routes: Routes = [
  { path: 'login', component: LoginComponent },
  {
    path: '', component: MainComponent,
    children: [
      { path: '', redirectTo: 'site-summary', pathMatch: 'full' },
      { path: 'site-summary', component: SiteSummaryComponent },
      { path: 'site-list/:id', component: SiteListComponent },
      { path: 'start-stop', component: StartStopComponent },
      { path: 'site-config', component: SiteConfigComponent }
    ]
  },
  { path: '**', component: PageNotFoundComponent }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
